<?php
/*
 * @Date: 2021-05-08 13:21:04
 * @Author: yukun
 * @LastEditors: yukun
 * @LastEditTime: 2021-05-08 14:06:54
 * @FilePath: /design-patterns-study/责任链模式/Dingtalk.php
 * @Description: 本文件主要功能为：
 */

class Dingtalk
{
    protected $lev = 1;
    protected $top = 'SMS';

    public function alert($lev)
    {
        if ($lev <= $this->lev) {
            echo "级别：{$lev} 钉钉报警" . PHP_EOL;
        } else {
            $top = new $this->top;
            $top->alert($lev);
        }
    }
}
